#include <iostream>
#include <unistd.h>
#include <pthread.h>

void *ThreadRoutine(void *args)
{
    while(true)
    {
        std::cout << "new thread" << std::endl;
        sleep(2);
    }
}
int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, ThreadRoutine, nullptr);

    while(true)
    {
        std::cout << "main thread" << std::endl;
        sleep(2);
    }
    return 0;
}